// pages/caicaicai/index.js
var numUser;
var numComputer;
Page({
  data:{
    focus:true
    
  },

  onLoad(options) {
    numComputer=parseInt(Math.random()*100);
    console.log('计算机想的：',numComputer);
  },
  guessData:function(e){
 
    console.log(e.detail.value);
    numUser=parseInt(e.detail.value)
  },
 
  caicaicai(e){
    let list=this.data.list

    if(list==null) list=[]
    console.log('list的值',list)
    list.push(numUser)
    if(list.length>8)list.shift();
    let result=null;
    if(numUser>numComputer){
      result='你猜大了'
    }else  if(numUser<numComputer){
      result='你猜小了'
    }else{
      result='恭喜你猜对了'
    }
    this.setData({
      result,
      list,
      userData:null,
       focus:true})
  }

  
 
  
  
})